<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>欢迎注册</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
    <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
    <!-- bootstrap.bundle.min.js 用于弹窗、提示、下拉菜单，包含了 popper.min.js -->
    <script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>
    <!-- 最新的 Bootstrap4 核心 JavaScript 文件 -->
    <script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
    <script>
        function isNull(str) {
            if (str === "" || str == null || typeof(str) == "undefined")
                return true;
            var regu = "^[ ]+$";
            var re = new RegExp(regu);
            return re.test(str);
        }
        $(function () {
            $("#add").click(function () {
                var nameVal = $("#name").val();
                var pwdVal = $("#password").val();
                var roleVal = $("#role option:selected").text();
                if (isNull(nameVal) || isNull(pwdVal) || isNull(roleVal)) {
                    confirm("请完善信息");
                    return;
                }
                $("#add").submit();
            });

        });
    </script>
</head>
<body>
<h1>欢迎注册</h1>
<form name="addUser" action="/registerUser" method="post" enctype="multipart/form-data">
    <div class="form-group">
        <label for="name">name:</label>
        <input type="text" class="form-control" name="name" id="name">
    </div>
    <div class="form-group">
        <label for="password">Password:</label>
        <input type="password" class="form-control" name="password" id="password">
    </div>
    <div class="form-group">
        <label for="role">role:</label>
        <select class="form-control" name="role" id="role">
            <option>admin</option>
            <option>user</option>
        </select>
    </div>
    <input id="add" type="submit" value="注册">
</form>
</body>
</html>